﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Qianke.Core.Common.Decode
{
    public class HexHelper
    {
        public static string BytesToHexString(byte[] bytes)
        {
            return string.Join("", bytes.Select(u => u.ToString("X2")));
        }

        public static byte[] HexStringToBytes(string hexString)
        {
            return Regex.Matches(hexString, ".{2}").Cast<Match>().Select(u => Convert.ToByte(u.Value, 16)).ToArray();
        }
    }
}
